package com.ie.cloud.payment.init;

import com.ie.cloud.payment.cache.RedisUtil;
import com.ie.cloud.payment.service.impl.PayOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Created with FR
 *
 * @Author: DQ
 * @Date: 2025/07/22/17:17
 * @Description: 订单号缓存初始化
 */
@Component
@Slf4j
public class PayOrderIdCacheInit implements CommandLineRunner {


    @Resource
    private PayOrderService payOrderService;




    @Override
    public void run(String... args) {

        log.info("订单号缓存初始化启动");

        Map<String, Object> map = payOrderService.GetPayOrderId();


        map.forEach(RedisUtil::setObject);

        log.info("订单号缓存初始化完成");

    }
}
